#!/bin/sh

# get the current path
CURPATH=`pwd`

inotifywait -mr --timefmt '%d/%m/%y %H:%M' --format '%T %w %f' -e close_write /home/uriah/NNTP/Legacy | while read date time dir file; do

    FILECHANGE=${dir}${file}
# convert absolute path to relative
    FILECHANGEREL=`echo "$FILECHANGE" | sed 's_'$CURPATH'/__'`

#    /home/milton/Desktop/fedora.up

    rsync --exclude 'data' --exclude 'notify' -av -e ssh /home/uriah/NNTP/Legacy/ root@www2.whisper.net:/var/www/html

    echo "At ${time} on ${date}, file $FILECHANGE was changed"
done

